#ifndef READPORT_H
#define READPORT_H

#include <QObject>
#include <QThread>
#include <QTimer>
#include <QDebug>
#include <QtGlobal>

#ifdef Q_OS_LINUX
#include "posix_qextserialport.h"
#endif

#ifdef Q_OS_WIN32
#include "win_qextserialport.h"
#endif

#define MAX_BUF_LEN 256

class ReadPort : public QObject
{
    Q_OBJECT
public:
    ReadPort();
#ifdef Q_OS_LINUX
    ReadPort( Posix_QextSerialPort *mycom, int isHex );
    Posix_QextSerialPort *myPort;
#elif defined(Q_OS_WIN)
    ReadPort( Win_QextSerialPort *mycom, int isHex );
    Win_QextSerialPort *myPort;
#endif
    int isShowHex;
    
private:
    QTimer *readTimer;

signals:
    void sendDatas(QString);
    
public slots:
    void slot_read_com();               //监听并读取串口数据
    void slot_read_timer();
    void slot_program_exit();
    
};

#endif // READPORT_H
